package es.unex.meigas.core;

import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;

import es.unex.meigas.gui.World2Device;

public class DasocraticProject extends DasocraticElement implements Serializable{
	
	public DasocraticProject(){
		
		super();
		
		setName("Proyecto");

	}

	protected DasocraticElement _addElement(DasocraticElement element) {

		if (element instanceof AdministrativeUnit){
			m_Elements.add(element);
			element.setParent(this);
			return this;
		}
		else{
			return null;
		}
		
	}

	public Rectangle2D getBoundingBox() {
		
		return null;
		
	}

	public void paint(Graphics g, World2Device w2d) {}
	
	public double getArea() {
		
		int i;
		double dArea = 0;
		double dUnitArea;
		
		for (i = 0; i < m_Elements.size(); i++){
			dUnitArea = ((DasocraticElement)m_Elements.get(i)).getArea();
			if (dUnitArea != NO_DATA){
				dArea += dUnitArea;
			}
		}
		
		if (dArea == 0){
			dArea = NO_DATA;
		}
		
		return dArea;

	}

	public String[] getReport() {

		return null;
		
	}

}
